package com.zc.trendsDispatch.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.zc.iotDevice.domain.ChargeStationPile;
import com.zc.operator.domain.ChargeStation;
import com.zc.trendsDispatch.domain.ChargeStationDispatch;
import com.zc.trendsDispatch.domain.ChargeStationRealPowerHis;
import com.zc.trendsDispatch.service.StationDispatchService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.config.ldap.LdapUserServiceBeanDefinitionParser;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

import static com.ruoyi.common.utils.PageUtils.startPage;


/**
 * @Author glb
 * @Date 2023/12/13 10:43
 * @Version 1.0
 */
@Controller
@RequestMapping("stationDispatch/real")
public class StationDispatchController extends BaseController {

    @Resource
    private StationDispatchService stationDispatchService;

    /**
     * 查询场站实时功率
     * @param chargeStation 场站调度对象
     * @return 获取场站实时功率
     */
    @PreAuthorize("@ss.hasPermi('stationDispatch:real:list')")
    @GetMapping(value = "list")
    @ResponseBody
    public TableDataInfo getStationRealPower(ChargeStation chargeStation){
        startPage();
        List<ChargeStation> stationRealPower =stationDispatchService.getStationRealPower(chargeStation);
        return getDataTable(stationRealPower);
    }

    /**
     * 查询场站详情信息
     * @param chargeStation 充电桩对象
     * @return 获取场站详情信息
     */
    @PreAuthorize("@ss.hasPermi('stationDispatch:real:details')")
    @GetMapping(value = "details")
    @ResponseBody
    public TableDataInfo getStationRealDetails(ChargeStationPile chargeStation){
        List<ChargeStationPile> stationRealDetails = stationDispatchService.getStationRealDetails(chargeStation);
        return getDataTable(stationRealDetails);
    }


}
